package com.gt.xmall.repository;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class SysResourceDaoEx {
	@Autowired
	protected JdbcTemplate jdbcTemplate;

	public List getMenusByUserCode(String userCode) {
		String sql = "SELECT DISTINCT sr.* FROM sys_user_role sur,res_role rr ,sys_resource sr "
				+ "WHERE sur.role_id=rr.role_id AND rr.res_id=sr.RES_ID and sr.RES_TYPE=0  AND sur.user_code='"
				+ userCode + "' ORDER BY sr.TREE_LEVEL,sr.sort_NO";
		return jdbcTemplate.queryForList(sql);
	}

}
